<?php
/**
 * Created by PhpStorm.
 * User: qttx
 * Date: 2019/5/30
 * Time: 15:06
 */

namespace app\admin\controller;
use app\admin\model\RealModel;
use think\Request;
use think\Session;


class Realname extends BaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->real = new RealModel();
    }
	//实名认证列表的显示
    public function index(){
        $list = $this->real->index();
        $page = $list->render();
        $count = count($list);
        $this->assign('list',$list);
        $this->assign('page',$page);
        $this->assign('count',$count);
        return view('realname/index');
    }
    //修改
	public function edit()
    {
        if(request()->isAjax())
        {
            $res = $this->real->edit();
            if($res)
            {
                return ['code'=>'1','message'=>'修改成功'];
            }else{
                return ['code'=>'0','message'=>'修改失败'];
            }
        }
        $id = input('id');
        $data = $this->real->getOneId($id);
        $this->assign('data',$data);
        return view('realname/edit');
    }
    //删除认证信息
    public function del(){
        $res = $this->order->del();
        if($res)
        {
            return ['code'=>'1','message'=>'删除成功'];
        }else{
            return ['code'=>'0','message'=>'删除失败'];
        }
    }
	//批量删除
    public function dell(){
        $res = $this->order->dell();
        if($res)
        {
            return ['code'=>'1','message'=>'删除成功'];
        }else{
            return ['code'=>'0','message'=>'删除失败'];
        }
    }
}